libsdl3: Added extra configuration options#9775
Conversation
This patch adds extra configuration options to allow to disable parts of sdl3 that we don't need.
There was a problem hiding this comment.
Code Review
This pull request introduces granular configuration options for libsdl3, allowing users to toggle specific features like video, audio, and GPU support. It refactors the package's dependency logic to conditionally include headers and libraries based on these configurations. The review feedback identifies typos in the configuration descriptions and highlights necessary adjustments for platform-specific dependencies, specifically regarding wasm and X11.
| add_configs("haptic", { description = "Enable haptic input support", default = true, type = "boolean"}) | ||
| add_configs("camera", { description = "Enable support for SDL_Camera", default = true, type = "boolean"}) | ||
| add_configs("storage", { description = "Enable support for SDL_Storage", default = true, type = "boolean"}) | ||
| add_configs("process", { description = "Enable support for SDL's cross-platform process spawing", default = true, type = "boolean"}) |
| add_configs("process", { description = "Enable support for SDL's cross-platform process spawing", default = true, type = "boolean"}) | ||
| add_configs("dialog", { description = "Enable support for SDL's native file/directory picker and dialog", default = true, type = "boolean"}) | ||
| add_configs("tray", { description = "Enable support for SDL's tray system API", default = true, type = "boolean"}) | ||
| add_configs("filesystem", { description = "Enable support for SDL's standar file path handling", default = true, type = "boolean"}) |
| on_load(function (package) | ||
| local supports_video = package:config("video") | ||
|
|
||
| if supports_video then |
There was a problem hiding this comment.
| end | ||
| if package:is_plat("linux", "bsd", "cross") and package:config("x11") then | ||
| if package:is_plat("linux", "bsd", "cross") and package:config("x11") and supports_video then | ||
| local deplibs = {"libx11", "libxcb", "libxext", "libxcursor", "libxfixes", "libxi", "libxrandr", "libxrender", "libxss"} |
There was a problem hiding this comment.
The xorgproto dependency is missing from the deplibs list in on_load. It must be added as a direct dependency here so that package:dep("xorgproto") can successfully retrieve its include directories in the on_install block (line 191).
local deplibs = {"libx11", "libxcb", "libxext", "libxcursor", "libxfixes", "libxi", "libxrandr", "libxrender", "libxss", "xorgproto"}
This patch adds extra configuration options to allow to disable parts of sdl3 that we don't need.